public class LoginException {
private String UserName="user";
private String PassWord="123456";

    public String getUserName() {
        return UserName;
    }

    public void setUserName(String userName) {
        UserName = userName;
    }

    public String getPassWord() {
        return PassWord;
    }

    public void setPassWord(String passWord) {
        PassWord = passWord;
    }

    public void Login(String UserName,String PassWord) throws UserNameException,
            PassWordException{

        if(UserName.equals(this.UserName)&&PassWord.equals(this.PassWord)){
            System.out.println("登录成功");
        }else if(!UserName.equals(this.UserName)){
            throw new UserNameException("用户名错误");
        }else if(!PassWord.equals(this.PassWord)){
            throw new PassWordException("密码错误");
        }
    }
}